Fix crash in garmin when uploading waypoints w/o description set.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 10 Oct 2002 16:08:13 +0000 (16:08 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 10 Oct 2002 16:08:13 +0000 (16:08 +0000)
gpsbabel/garmin.c

index c85195b57eb99373785d5d27439d313ac34547a0..b1df22a3725be773497f13e9a0c39c5b99326799 100644 (file)
@@ -105,7 +105,12 @@ data_write(void)
                                wpt->shortname;
 
                strncpy(way[i]->ident,  ident, sizeof(way[i]->ident));
-               strncpy(way[i]->cmnt, wpt->description, sizeof(way[i]->cmnt));
+               if (wpt->description) {
+                       strncpy(way[i]->cmnt, wpt->description, 
+                                       sizeof(way[i]->cmnt));
+               } else {
+                       way[i]->cmnt[0] = 0;
+               }
                way[i]->lon = wpt->position.longitude.degrees;
                way[i]->lat = wpt->position.latitude.degrees;
                way[i]->alt = wpt->position.altitude.altitude_meters;